﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.Xml;
using TomanuExtensions;
using TomanuExtensions.Utils;

namespace AmiEmuLib.AmigaConfiguration.CoreConfig
{
    /// <summary>
    /// MMU configuration.
    /// </summary>
    [DebuggerDisplay("Model = {Model}")]
    public class MMU : XmlBase
    {
        /// <summary>
        /// MMU model.
        /// </summary>
        public MMUModel Model;

        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="a_reader"></param>
        public MMU(XmlReader a_reader)
            : base(a_reader)
        {
        }

        protected override void ReadXml(XmlReader a_reader)
        {
            Model = a_reader.GetAttributeEnum<MMUModel>("Model");

            a_reader.MoveToNextElement(GetType().Name);
        }

        public override void WriteXml(XmlWriter a_writer)
        {
            a_writer.WriteStartElement(GetType().Name);

            a_writer.WriteAttribute("Model", Model);

            a_writer.WriteEndElement();
        }
    }
}
